<?php $this->_extends('_layouts/main_layout'); ?>
<?php $this->_block('title'); ?>
	Update Blue Bar Offer
<?php $this->_endblock(); ?>

<?php $this->_block('contents'); ?>

<div id="content" class="box">
	<h1>Blue Bar Offers</h1>
		<?php if (isset($infos)) 
				{
					foreach ($infos as $info)
					{
		?>
				<p class="msg info"><?php echo $info;?></p>
		<?php		}
				}
		?>
		<fieldset>
			<legend>Blue Bar Offers</legend>
		<?php if (isset($errors)) 
				{
					foreach ($errors as $error)
					{
		?>
				<p class="msg error"><?php echo $error;?></p>
		<?php		}
				}
		?>
			<form method="post" action="<?php echo url('bluebaroffer/update');?>">
				<input type="hidden" name="id" value="<?php echo isset($blueBarOffer['id']) ? $blueBarOffer['id'] : '';?>" />
				<dl>
					<dt><label>Site:</label></dt>
					<dd>
						<?php
							 echo Util::buildDropDownList(
							 	array('id'=>'site', 'name'=>'site_id'),
							 	$sites,
							 	isset($blueBarOffer['site_id']) ? $blueBarOffer['site_id']: false,
							 	array('k'=>'', 'l'=>'--All--')
							 );
						?>
					</dd>
				</dl>
				<dl>
					<dt><label>Partner Name:</label></dt>
					<dd>
						<select name="partner_name">
							<option value="PeanutLabs" <?php echo (isset($blueBarOffer['partner_name']) && $blueBarOffer['partner_name'] == 'PeanutLabs') ? 'selected=selected' : '';?>>Peanut Labs</option>
							<option value="SuperRewards" <?php echo (isset($blueBarOffer['partner_name']) && $blueBarOffer['partner_name'] == 'SuperRewards') ? 'selected=selected' : '';?>>Super Rewards</option>
							<option value="RadiumOne" <?php echo (isset($blueBarOffer['partner_name']) && $blueBarOffer['partner_name'] == 'RadiumOne') ? 'selected=selected' : '';?>>Radium One</option>
							<option value="SponsorPay" <?php echo (isset($blueBarOffer['partner_name']) && $blueBarOffer['partner_name'] == 'SponsorPay') ? 'selected=selected' : '';?>>SponsorPay</option>
							<option value="NoneOfAbove" <?php echo (isset($blueBarOffer['partner_name']) && $blueBarOffer['partner_name'] == 'NoneOfAbove') ? 'selected=selected' : '';?>>None Of Above</option>
						</select>
					</dd>
				</dl>
				<dl>
					<dt><label>Offer Text:</label></dt>
					<dd>
						<input type="text" name="offer_text" id="offer_text" value="<?php echo isset($blueBarOffer['offer_text']) ? $blueBarOffer['offer_text'] : ''; ?>" width="100%" class="txt_link"/>
					</dd>
				</dl>
				<dl>
					<dt><label>Offer Link(place holder INSERT_END_USER_ID for user id):</label></dt>
					<dd>
						<input type="text" name="link" id="link" value="<?php echo isset($blueBarOffer['link']) ? $blueBarOffer['link'] : ''; ?>" width="100%" class="txt_link"/>
					</dd>
				</dl>
				<dl>
					<dt><label>Credit:</label></dt>
					<dd>
						<input type="text" name="credit" id="credit" value="<?php echo isset($blueBarOffer['credit']) ? $blueBarOffer['credit'] : ''; ?>" />
					</dd>
				</dl>
				<dl>
					<dt><label>Order:</label></dt>
					<dd>
						<select name="order">
							<option value="1" <?php echo (isset($blueBarOffer['ord']) && $blueBarOffer['ord'] == 1) ? 'selected=selected' : '';?>>1</option>
							<option value="2" <?php echo (isset($blueBarOffer['ord']) && $blueBarOffer['ord'] == 2) ? 'selected=selected' : '';?>>2</option>
							<option value="3" <?php echo (isset($blueBarOffer['ord']) && $blueBarOffer['ord'] == 3) ? 'selected=selected' : '';?>>3</option>
							<option value="4" <?php echo (isset($blueBarOffer['ord']) && $blueBarOffer['ord'] == 4) ? 'selected=selected' : '';?>>4</option>
							<option value="5" <?php echo (isset($blueBarOffer['ord']) && $blueBarOffer['ord'] == 5) ? 'selected=selected' : '';?>>5</option>
							<option value="6" <?php echo (isset($blueBarOffer['ord']) && $blueBarOffer['ord'] == 6) ? 'selected=selected' : '';?>>6</option>
							<option value="7" <?php echo (isset($blueBarOffer['ord']) && $blueBarOffer['ord'] == 7) ? 'selected=selected' : '';?>>7</option>
							<option value="8" <?php echo (isset($blueBarOffer['ord']) && $blueBarOffer['ord'] == 8) ? 'selected=selected' : '';?>>8</option>
							<option value="9" <?php echo (isset($blueBarOffer['ord']) && $blueBarOffer['ord'] == 9) ? 'selected=selected' : '';?>>9</option>
							<option value="10" <?php echo (isset($blueBarOffer['ord']) && $blueBarOffer['ord'] == 10) ? 'selected=selected' : '';?>>10</option>
						</select>
					</dd>
				</dl>
				<dl id="set_partial">
					<dt>
						<label for="is_partial">Is Partial</label>
						<input type="checkbox" name="is_partial" id="is_partial" <?php echo (isset($blueBarOffer['is_partial']) && $blueBarOffer['is_partial'] == 1)? 'checked="checked"' : ''; ?> value="1" />
						<script>
							$('[name="partner_name"]').change(function(){
								if($(this).val() != 'RadiumOne'){
									$('#set_partial').hide();
									$('#is_partial').removeAttr('checked');
								}else{
									$('#set_partial').show();
								}
							});
							$('[name="partner_name"]').change();
						</script>
					</dt>
				</dl>
				<input type="submit" value="Update BlueBar Offer" /> 
			</form>
		</fieldset>
		
</div>
<?php $this->_endblock(); ?>